import { createStore } from 'vuex';

const store = createStore({
  state: {
    reports: [],
    currentReport: null,
  },
  mutations: {
    setReports(state, reports) {
      state.reports = reports;
    },
    setCurrentReport(state, report) {
      state.currentReport = report;
    },
    addReport(state, report) {
      state.reports.push(report);
    },
    removeReport(state, reportId) {
      state.reports = state.reports.filter(report => report.id !== reportId);
    },
  },
  actions: {
    fetchReports({ commit }) {
      // Fetch reports from the backend API and commit to state
    },
    uploadReport({ commit }, report) {
      // Upload report to the backend API and commit to state
    },
    deleteReport({ commit }, reportId) {
      // Delete report from the backend API and commit to state
    },
  },
  getters: {
    allReports: (state) => state.reports,
    currentReport: (state) => state.currentReport,
  },
});

export default store;